package cn.edu.fzu.homemaking.company.api;

import cn.edu.fzu.homemaking.company.domain.enums.CommentStatusEnum;
import cn.edu.fzu.homemaking.company.domain.enums.OrderStatusEnum;
import cn.edu.fzu.homemaking.web.Result;
import org.apache.ibatis.annotations.Param;
import org.springframework.cloud.openfeign.FeignClient;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestParam;

import javax.servlet.http.HttpServletRequest;
import java.math.BigDecimal;
import java.util.List;

/**
 * @author wanjie
 * @version 1.0
 */
@FeignClient(name = "order")
public interface OrderApi {

    @GetMapping("/api/order/auth/list")
    Result list(@RequestParam("demandId") Long demandId, @RequestParam("serverId") Long serverId,
                @RequestParam("startTime") String startTime, @RequestParam("endTime") String endTime,
                @RequestParam("status") OrderStatusEnum status, @RequestParam("commentStatus") CommentStatusEnum commentStatus,
                @RequestParam("pageNum") Integer pageNum, @RequestParam("pageSize") Integer pageSize);


    @GetMapping("/api/order/auth/selectByOrderId")
    Result single(@RequestParam("orderId") String orderId);


    @PostMapping("/api/order/auth/updateStatus")
    Result updateOrderStatus(@RequestParam("orderId") String orderId, @RequestParam("status") OrderStatusEnum status);


    @PostMapping("/api/order/auth/insert")
    Result insertOrder(@RequestParam("companyId") Long companyId,@RequestParam("userId") Long userId,
                       @RequestParam("demandId") Long demandId, @RequestParam("serverId") Long serverId,
                       @RequestParam("description") String description, @RequestParam("customerName") String customerName,
                       @RequestParam("address") String address, @RequestParam("phone") String phone,
                       @RequestParam("email") String email, @RequestParam("startTime") String startTime,
                       @RequestParam("price") BigDecimal price, @RequestParam("qty") Integer qty);

    @GetMapping("/api/order/auth/listByOrderIds")
    Result listByOrderIds(@RequestParam("orderIds") List<String> orderIds, @RequestParam("startTime") String startTime,
                          @RequestParam("endTime") String endTime, @RequestParam("status") OrderStatusEnum status);

    @GetMapping("/api/order/auth/count")
    Result count(@RequestParam("startTime") String startTime, @RequestParam("endTime") String endTime);

    @GetMapping("/api/order/auth/countByMonth")
    Result countByMonth(@RequestParam("startTime") String startTime, @RequestParam("endTime") String endTime);

    @GetMapping("/api/order/auth/countByDay")
    Result countByDay(@RequestParam("startTime") String startTime, @RequestParam("endTime") String endTime);
}
